process.env.NODE_ENV = 'production'
// 开始下一步

const webpack = require('webpack')
const webpackConfig = require('../webpack.config.js')
// const builder = require('electron-builder')

webpack(webpackConfig, (err, stats) => {
    console.log(stats.toString({
        chunks: false, // 使构建过程更静默无输出
        colors: true // 在控制台展示颜色
    }))
    if (err || stats.hasErrors()) {
        console.log('打包时产生错误，请调试')
        process.exit()
    }
    // 如果没有错误那么启动打包程序
    /*builder.build({
            ia32: true,
            config: {
                "appId": "com.generic.hxkuc.mgj",
                "productName": "美易通",
                "asarUnpack": [
                    "node_modules"
                ],
                "mac": {
                    "category": "your.app.category.type",
                    "target": [
                        "zip",
                        "dmg"
                    ]
                },
                "nsis": {
                    "oneClick": false,
                    "perMachine": true,
                    "allowToChangeInstallationDirectory": true,
                    "runAfterFinish": false
                },
                "publish": [{
                    "provider": "generic",
                    "url": "http://meiyitong.oss-cn-shanghai.aliyuncs.com"
                }]
            }
        })
        .catch((error) => {
            console.log(error)
        })
        .then(() => {
            console.log('打包成功！')
        })*/
})